//
//  ChargeGameRequest.m
//  EasyToo
//
//  Created by YuanDee on 13-10-13.
//
//

#import "ChargeGameRequest.h"

@implementation ChargeGameRequest
-(id)initWithGameId:(NSString *)gameId andGameUser:(NSString *)gameUser andCardNum:(NSString *)cardNum Delegate:(id<ServerCommunicationDelegate>)delegate
{
    self = [super init];
    if(self)
    {
        self.requestName = @"ChargeGameRequest";
        self.delegate = delegate;
        self.url = PROTOCOL_ORDER_URL;
        
        self.gameId = gameId;
        self.gameUser = gameUser;
        self.cardNum = cardNum.intValue;
        self.delegate = delegate;
        
        [self.bodyJsonDict setObject:self.gameUser forKey:@"game_userid" ];
        [self.bodyJsonDict setObject:self.gameId forKey:@"cardid"];
        [self.bodyJsonDict setObject:[NSNumber numberWithInt:self.cardNum]  forKey:@"cardnum"];
        [self.bodyJsonDict setObject:@"" forKey:@"game_srv"];
        [self.bodyJsonDict setObject:@"4.0" forKey:@"version"];
        [self.bodyJsonDict setObject:@"" forKey:@"game_area"];
        
        [self.headerJsonDict setObject:self.gameId forKey:@"TranCode"];
        [self.headerJsonDict setObject:[NSNumber numberWithInt:self.cardNum*100] forKey:@"TxAmt"];
        
        [self buildJsonRequest];
    }
    return self;
}

-(void)dealloc
{
    self.gameId = nil;
    self.gameUser = nil;
    [super dealloc];
}

@end
